package cn.xshi.log.service.impl;

import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import cn.xshi.log.dao.LogStartStopDao;
import cn.xshi.log.form.LogStartStopForm;
import cn.xshi.log.model.LogStartStop;
import cn.xshi.log.service.LogStartStopService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* @Desc 服务器启动与关闭日志
* @Author 邓纯杰
* @CreateTime 2022-08-24 12:28:59
*/
@Service
public class LogStartStopServiceImpl extends BaseService implements LogStartStopService {

	@Resource
	private LogStartStopDao logStartStopDao;

	/**
	* 分页
	* @param logStartStopForm
	* @return
	*/
	public List<LogStartStop> getLogStartStopListByCondition(LogStartStopForm logStartStopForm){
		try{
			return logStartStopDao.getLogStartStopListByCondition(logStartStopForm);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 查询对象
	* @param id 
	* @return
	*/
	public LogStartStop getLogStartStopById(String id){
		try{
			LogStartStop logStartStop = logStartStopDao.getLogStartStopById(id);
			return logStartStop;
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 添加
	* @param logStartStop 
	* @return
	*/
	public int addLogStartStop(LogStartStop logStartStop){
		int i = 0;
		try {
			i = logStartStopDao.addLogStartStop(logStartStop);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改
	* @param logStartStop 
	* @return
	*/
	public int updateLogStartStop(LogStartStop logStartStop){
		int i = 0;
		try {
			i = logStartStopDao.updateLogStartStop(logStartStop);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改（根据动态条件）
	* @param logStartStop 
	* @return
	*/
	public int updateLogStartStopBySelective(LogStartStop logStartStop){
		int i = 0;
		try {
			i = logStartStopDao.updateLogStartStopBySelective(logStartStop);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delLogStartStop(Map<String,Object> condition){
		int i = 0;
		try {
			i = logStartStopDao.delLogStartStop(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
